#ifndef PARTICLESPRINGGENERATOR_H
#define PARTICLESPRINGGENERATOR_H

#include "AbstractParticleForceGenerator.h"

namespace SimPhy {


/**
  * A force generator that applies a spring force.
  */
class ParticleSpringGenerator : public AbstractParticleForceGenerator
{
public:
    /** Creates a new spring with the given parameters. */
    ParticleSpringGenerator(Particle *other, real const springConstant, real const restLenght);

    virtual ~ParticleSpringGenerator();

    /** Applies the spring force to the given particle. */
    virtual void updateForce(Particle *particle, real timeStep);

private:

    /** The particle at the other end of the spring. */
    Particle *m_other;

    /** Holds the spring constant. */
    real m_springConstant;

    /** Holds the rest lenght of the spring. */
    real m_restLenght;

};

}

#endif // PARTICLESPRINGGENERATOR_H
